export default{
    // sku排列算法
    cartesianProductOf(){
        return Array.prototype.reduce.call(arguments,function(a,b){
            var ret = [];
            a.forEach(function(a){
                b.forEach(function(b){
                    ret.push(a.concat(b));
                });
            });
            return ret;
        },[[]]);
    },
    swapArray(arr,index1,index2){
        arr[index1]=arr.splice(index2,1,arr[index1])[0]
        return arr;
    },
    moveUp(arr,index){
        this.swapArray(arr,index,index-1);
    },
    moveDown(arr,index){
        this.swapArray(arr,index,index+1);
    }
}